home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / World / Map / Cell / CCell.as
Encoding:
Text File  |  2011-08-19  |  5.3 KB  |  186 lines

  1.  
  2. {
  3.    if(true)
  4.    {
  5.       CCell = ┬º┬ºnewclass(CCell,EventDispatcher);
  6.    }
  7. }
  8.  
  9. package Local.Game.World.Map.Cell
  10. {
  11.    import Local.Game.Thing.*;
  12.    import Local.Game.World.*;
  13.    import Local.Game.World.Map.*;
  14.    import flash.events.*;
  15.    import flash.geom.*;
  16.    
  17.    public class CCell extends EventDispatcher
  18.    {
  19.       
  20.       public static const THING_REMOVED:String = "THING_REMOVED";
  21.       
  22.       public static const mSize:int = 50;
  23.       
  24.       public static const THING_ADDED:String = "THING_ADDED";
  25.        
  26.       
  27.       public var mLowAlt:Number;
  28.       
  29.       public var mNext:CCell;
  30.       
  31.       public var mAverageAlt:Number;
  32.       
  33.       public var mMapwhoCount:int;
  34.       
  35.       public var mMapwho:Object;
  36.       
  37.       public var rMapwho:Object;
  38.       
  39.       public var mDumbCell:Boolean;
  40.       
  41.       public var mPrev:CCell;
  42.       
  43.       public var mHighAlt:Number;
  44.       
  45.       public var rMapwhoCount:int;
  46.       
  47.       public var mapX:int;
  48.       
  49.       public function CCell(param1:int, param2:Array = null)
  50.       {
  51.          var _loc3_:* = NaN;
  52.          if(true)
  53.          {
  54.             super();
  55.             if(true)
  56.             {
  57.                mMapwho = new Object();
  58.                if(true)
  59.                {
  60.                   mMapwhoCount = 0;
  61.                   if(true)
  62.                   {
  63.                      rMapwho = new Object();
  64.                      if(true)
  65.                      {
  66.                         rMapwhoCount = 0;
  67.                         mapX = param1;
  68.                      }
  69.                      if(param2)
  70.                      {
  71.                         addr42:
  72.                         mLowAlt = 0;
  73.                         addr45:
  74.                         mHighAlt = 1000000;
  75.                         mAverageAlt = 0;
  76.                         addr58:
  77.                         var _loc4_:int = 0;
  78.                         var _loc5_:* = param2;
  79.                         for(; ┬º┬ºhasnext(_loc5_,_loc4_); mAverageAlt += _loc3_)
  80.                         {
  81.                            ┬º┬ºpush(┬º┬ºnextvalue(_loc4_,_loc5_));
  82.                            if(true)
  83.                            {
  84.                               _loc3_ = ┬º┬ºpop();
  85.                               ┬º┬ºpush(_loc3_);
  86.                               ┬º┬ºpush(mHighAlt);
  87.                               if(true)
  88.                               {
  89.                                  if(┬º┬ºpop() < ┬º┬ºpop())
  90.                                  {
  91.                                     mHighAlt = _loc3_;
  92.                                     continue;
  93.                                  }
  94.                                  addr82:
  95.                                  ┬º┬ºpush(_loc3_);
  96.                                  ┬º┬ºpush(mLowAlt);
  97.                               }
  98.                               if(┬º┬ºpop() > ┬º┬ºpop())
  99.                               {
  100.                                  mLowAlt = _loc3_;
  101.                               }
  102.                               continue;
  103.                            }
  104.                            ┬º┬ºgoto(addr82);
  105.                         }
  106.                         if(true)
  107.                         {
  108.                            mAverageAlt /= param2.length;
  109.                         }
  110.                         addr48:
  111.                      }
  112.                      return;
  113.                   }
  114.                   ┬º┬ºgoto(addr42);
  115.                }
  116.                ┬º┬ºgoto(addr45);
  117.             }
  118.             ┬º┬ºgoto(addr48);
  119.          }
  120.          ┬º┬ºgoto(addr58);
  121.       }
  122.       
  123.       public function AddThing(param1:*) : void
  124.       {
  125.          mMapwho[param1.mID] = param1;
  126.          var _loc2_:*;
  127.          ┬º┬ºpush((_loc2_ = ┬º┬ºfindproperty(mMapwhoCount)).mMapwhoCount);
  128.          if(true)
  129.          {
  130.             ┬º┬ºpush(┬º┬ºpop() + 1);
  131.          }
  132.          var _loc3_:* = ┬º┬ºpop();
  133.          _loc2_.mMapwhoCount = _loc3_;
  134.          dispatchEvent(new CEvent("THING_ADDED",param1));
  135.       }
  136.       
  137.       public function AddRefThing(param1:*) : void
  138.       {
  139.          rMapwho[param1.mID] = param1;
  140.          var _loc2_:*;
  141.          ┬º┬ºpush((_loc2_ = ┬º┬ºfindproperty(rMapwhoCount)).rMapwhoCount);
  142.          if(true)
  143.          {
  144.             ┬º┬ºpush(┬º┬ºpop() + 1);
  145.          }
  146.          var _loc3_:* = ┬º┬ºpop();
  147.          _loc2_.rMapwhoCount = _loc3_;
  148.       }
  149.       
  150.       public function InCell(param1:Number) : Boolean
  151.       {
  152.          return mapX == Math.floor(param1 / CMap.mCellSize);
  153.       }
  154.       
  155.       public function RemoveRefThing(param1:*) : void
  156.       {
  157.          if(true)
  158.          {
  159.             var _loc2_:*;
  160.             ┬º┬ºpush((_loc2_ = ┬º┬ºfindproperty(rMapwhoCount)).rMapwhoCount);
  161.             if(true)
  162.             {
  163.                ┬º┬ºpush(┬º┬ºpop() - 1);
  164.             }
  165.             var _loc3_:* = ┬º┬ºpop();
  166.             _loc2_.rMapwhoCount = _loc3_;
  167.             delete rMapwho[param1.mID];
  168.          }
  169.       }
  170.       
  171.       public function RemoveThing(param1:*) : void
  172.       {
  173.          var _loc2_:*;
  174.          ┬º┬ºpush((_loc2_ = ┬º┬ºfindproperty(mMapwhoCount)).mMapwhoCount);
  175.          if(true)
  176.          {
  177.             ┬º┬ºpush(┬º┬ºpop() - 1);
  178.          }
  179.          var _loc3_:* = ┬º┬ºpop();
  180.          _loc2_.mMapwhoCount = _loc3_;
  181.          delete mMapwho[param1.mID];
  182.          dispatchEvent(new CEvent("THING_REMOVED",param1));
  183.       }
  184.    }
  185. }
  186.